package com.ykzb.talent.dao.impl;

import com.ykzb.talent.dao.ITalentDao;
import com.ykzb.talent.mapper.TalentMapper;
import com.ykzb.talent.model.Talent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by mac on 2017/4/7.
 */
@SuppressWarnings("restriction")
@Repository("talentDao")
public class TalentDaoImpl implements ITalentDao{

    @Autowired
    private TalentMapper talentMapper;

    @Override
    public void insert(Talent talent) throws Exception {
        if (talent!=null)
        {
            talentMapper.insert(talent);
        }
    }

    /**
     * 根据用户ID查找人才的数量
     * @param userId
     * @return
     * @throws Exception
     */
    @Override
    public Integer selectTalentNumByUserId(Long userId) throws Exception {
        if (userId!=null){
            return  talentMapper.selectTalentNumByUserId(userId);
        }else{
            return 0;
        }
    }
}
